home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / ZIPPED / LISTINGS / V_12_11.ZIP / ALLISON.ZIP / FORM.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  397 b   |  25 lines

  1. LISTING 14 - More Form member functions
  2. // form.cpp
  3.  
  4. #include <assert.h>
  5. #include "form.h"
  6. #include "field.h"
  7.  
  8. int Form::add(Field *fp)
  9. {
  10.     assert(fp);
  11.     if (nfields >= MAXFIELDS)
  12.         return -1;
  13.  
  14.     fields[nfields] = fp;
  15.     return nfields++;
  16. }
  17.  
  18. Form::~Form()
  19. {
  20.     // Assumes fields are on heap
  21.     for (int i = 0; i < nfields; ++i)
  22.         delete fields[i];
  23. }
  24.  
  25.